import {
  wxRequest
} from '../../utils/server.js';
const _wxRequest = new wxRequest();
const app = getApp()
Page({
  data: {
    imgUrl: app.globalData.imgUrl,
    uploadUrl: wx.getStorageSync('uploadUrl'),
    id: null
  },


  onLoad: function (options) {
    console.log(options, 'options')
    if (options.id) {
      this.setData({
        id: options.id
      })
    }
  },
  onShow: function () {
    this.getdetail()
  },

 

  //获取详情
  getdetail: function () {
    _wxRequest.wxTonkenAjax({
      url: app.globalData.apiUrl + '/odr/protected/order/detail?id=' + this.data.id,
      method: 'POST',
    }, (res) => {
      var resVo = res.vo
      if (resVo.detailJson && typeof resVo.detailJson == 'string') {
        resVo.detailJson = JSON.parse(resVo.detailJson)
      }
      var expressList = []
      if (resVo.expressJson && typeof resVo.expressJson == 'string') {
        resVo.expressJson = JSON.parse(resVo.expressJson)
        expressList = resVo.expressJson.datas.list
      } 
      this.setData({
        detail: resVo,
        expressList
      }) 

    })
  },

  
  //评价
  assess: function (e) {
    wx.navigateTo({
      url: '/pages/shop_order/assess?id=' + e.currentTarget.dataset.id + '&itemid=' + e.currentTarget.dataset.itemid
    })
  },

  //追评
  assess2: function (e) {
    wx.navigateTo({
      url: '/pages/shop_order/assess?id=' + e.currentTarget.dataset.id + '&itemid=' + e.currentTarget.dataset.itemid + '&assesstype=1'
    })
  },

  
})